package com.example.swd1.gudong.main.user.mymedal;

import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import com.example.swd1.gudong.R;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by user on 9/14/16.
 */
public class RunningMedalFragment extends Fragment {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_medal_running, container, false);
        GridView obtainView = (GridView) rootView.findViewById(R.id.gv_medal_running_obtain);
        GridView unObtainView = (GridView) rootView.findViewById(R.id.gv_medal_running_not_obtain);
        MedalGridAdapter oAdapter = new MedalGridAdapter(getContext(), loadObtainMedalData());
        MedalGridAdapter uAdapter = new MedalGridAdapter(getContext(), loadUnObtainMedalData());
        obtainView.setAdapter(oAdapter);
        unObtainView.setAdapter(uAdapter);
        return rootView;
    }

    List<int[]> loadObtainMedalData() {
        List<int[]> obtainMedalData = new ArrayList<>();
        int[] bean = new int[2];
        bean[0] = R.drawable.ic_medal_l_day1;
        bean[1] = R.string.user_medal_start_run;
        obtainMedalData.add(bean);
        bean = new int[2];
        bean[0] = R.drawable.ic_medal_l_run5;
        bean[1] = R.string.user_medal_5km;
        obtainMedalData.add(bean);
        bean = new int[2];
        bean[0] = R.drawable.ic_medal_l_run10;
        bean[1] = R.string.user_medal_10km;
        obtainMedalData.add(bean);
        bean = new int[2];
        bean[0] = R.drawable.ic_medal_m_day7;
        bean[1] = R.string.user_medal_insist_run;
        obtainMedalData.add(bean);
        return obtainMedalData;
    }

    List<int[]> loadUnObtainMedalData() {
        List<int[]> obtainMedalData = new ArrayList<>();
        int[] bean = new int[2];
        bean[0] = R.drawable.ic_medal_l_run21_p;
        bean[1] = R.string.user_medal_half_marathon;
        obtainMedalData.add(bean);
        bean = new int[2];
        bean[0] = R.drawable.ic_medal_l_run42_p;
        bean[1] = R.string.user_medal_full_marathon;
        obtainMedalData.add(bean);
        bean = new int[2];
        bean[0] = R.drawable.ic_medal_l_run100_p;
        bean[1] = R.string.user_medal_super_marathon;
        obtainMedalData.add(bean);
        bean = new int[2];
        bean[0] = R.drawable.ic_medal_m_run10_p;
        bean[1] = R.string.user_medal_100km;
        obtainMedalData.add(bean);
        bean = new int[2];
        bean[0] = R.drawable.ic_medal_l_ride1000_p;
        bean[1] = R.string.user_medal_bike;
        obtainMedalData.add(bean);
        bean = new int[2];
        bean[0] = R.drawable.ic_medal_l_ride3200_p;
        bean[1] = R.string.user_medal_bike_round_f;
        obtainMedalData.add(bean);
        bean = new int[2];
        bean[0] = R.drawable.ic_medal_l_day21_p;
        bean[1] = R.string.user_medal_accustomed_sport;
        obtainMedalData.add(bean);
        bean = new int[2];
        bean[0] = R.drawable.ic_medal_l_ride100_p;
        bean[1] = R.string.user_medal_like_sport;
        obtainMedalData.add(bean);
        return obtainMedalData;
    }
}
